import store from '@/store'
// import router from './router'
/**
 * @description: 打开文档
 * @param {string} row 需要documentId，fileExtension
 * @return {*}
 */
export function openDocument(row) {
  if (row.fileExtension.indexOf('.pdf') !== -1) {
    window.open(
      process.env.VUE_APP_BASE_API +
            '/api/fd/pdf/get_document_by_pdf?documentId=' +
            row.documentId
    )
  } else {
    // 记录文件点击次数
    window.open(
      'onlyoffice/createDocument.html?&token=' +
           store.getters.token +
            '&documentId=' +
            row.documentId +
            '&mode=view' +
            '&urldata=' +
            process.env.VUE_APP_BASE_API
    )
  }
}
